package com.zx.cloud.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zx.cloud.ApiVersion;
import com.zx.cloud.RequestLogging;
import com.zx.cloud.common.filter.CurrentUserId;
import com.zx.cloud.domain.ClientAuth;
import com.zx.cloud.model.response.ObjectDataResponse;
import com.zx.cloud.model.response.Response;
import com.zx.cloud.service.ClientAuthService;

import io.swagger.annotations.ApiOperation;

/**
 * @Description:
 *
 * @author       Yan Weiwei
 * @Create Time: 2017年10月31日下午2:15:19
 */

@RestController
@RequestMapping(value = ApiVersion.PROVIDER_V1_PREFIX+"/clientAuth")
public class ClientAuthController {

	@Autowired
	private ClientAuthService clientAuthService;
	
	@RequestLogging
	@ApiOperation(value = "修改会员认证信息" , notes = "修改会员认证信息")
	@RequestMapping(value = "/updateClientAuth", method = RequestMethod.POST)
	@ResponseBody
	public Response updateClientAuth(@CurrentUserId Long userId,HttpServletRequest request,@RequestBody  ClientAuth clientAuth){
		clientAuth.setClientId(userId);
		int success = clientAuthService.update(clientAuth);
		return new ObjectDataResponse<Integer>(success);
	}
	
	@RequestLogging
	@ApiOperation(value = "添加会员认证信息" , notes = "添加会员认证信息")
	@RequestMapping(value = "/addClientAuth", method = RequestMethod.POST)
	@ResponseBody
	public Response addClientAuth(@CurrentUserId Long userId,HttpServletRequest request,@RequestBody  ClientAuth clientAuth){
		int success = clientAuthService.insert(clientAuth);
		return new ObjectDataResponse<Integer>(success);
	}
}
